package com.zhiwang.planet.ui.money

import android.os.Bundle
import androidx.databinding.DataBindingUtil
import com.zhiwang.planet.R
import com.zhiwang.planet.databinding.CommonListActivityBinding
import com.zhiwang.planet.di.component.DaggerUserComponent
import com.zhiwang.planet.di.module.AccountModule
import com.zhiwang.planet.di.module.AutoDisposeModule
import com.zhiwang.planet.mvvm.viewmodel.ItemDecorationViewModel
import com.zhiwang.planet.mvvm.viewmodel.ListMoneyViewModel
import com.zhiwang.planet.ui.BaseActivity
import kotlinx.android.synthetic.main.common_list_activity.*
import javax.inject.Inject

class CommonListActivity : BaseActivity() {


    @Inject
    lateinit var vm: ListMoneyViewModel

    @Inject
    lateinit var decoVm :ItemDecorationViewModel

    override fun initInjection() {
        super.initInjection()
        DaggerUserComponent.builder()
                .appComponent(getAppComponent())
                .autoDisposeModule(AutoDisposeModule(this))
                .accountModule(AccountModule(this))
                .build()
                .inject(this)
    }



    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val binding = DataBindingUtil.setContentView<CommonListActivityBinding>(this, R.layout.common_list_activity)

        setSupportActionBar(toolbar)
        binding.vm = vm
        binding.decorVm = decoVm

        binding.lifecycleOwner = this

        vm.loadGaoFan()
    }

}